home *** CD-ROM | disk | FTP | other *** search
-
- CHOWN(2) UNIX Programmer's Manual CHOWN(2)
-
- NNAAMMEE
- cchhoowwnn, ffcchhoowwnn - change owner and group of a file
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<uunniissttdd..hh>>
-
- _i_n_t
- cchhoowwnn(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _u_i_d___t _o_w_n_e_r, _g_i_d___t _g_r_o_u_p)
-
- _i_n_t
- ffcchhoowwnn(_i_n_t _f_d, _u_i_d___t _o_w_n_e_r, _u_i_d___t _g_r_o_u_p)
-
- DDEESSCCRRIIPPTTIIOONN
- The owner ID and group ID of the file named by _p_a_t_h or referenced by _f_d
- is changed as specified by the arguments _o_w_n_e_r and _g_r_o_u_p. The owner of a
- file may change the _g_r_o_u_p to a group of which he or she is a member, but
- the change _o_w_n_e_r capability is restricted to the super-user.
-
- CChhoowwnn() clears the set-user-id and set-group-id bits on the file to pre-
- vent accidental or mischievous creation of set-user-id and set-group-id
- programs.
-
- FFcchhoowwnn() is particularly useful when used in conjunction with the file
- locking primitives (see flock(2)).
-
- One of the owner or group id's may be left unchanged by specifying it as
- -1.
-
- RREETTUURRNN VVAALLUUEESS
- Zero is returned if the operation was successful; -1 is returned if an
- error occurs, with a more specific error code being placed in the global
- variable _e_r_r_n_o.
-
- EERRRROORRSS
- CChhoowwnn() will fail and the file will be unchanged if:
-
- [ENOTDIR] A component of the path prefix is not a directory.
-
- [ENAMETOOLONG]
- A component of a pathname exceeded {NAME_MAX} characters,
- or an entire path name exceeded {PATH_MAX} characters.
-
- [ENOENT] The named file does not exist.
-
- [EACCES] Search permission is denied for a component of the path
- prefix.
-
- [ELOOP] Too many symbolic links were encountered in translating the
- pathname.
-
- [EPERM] The effective user ID is not the super-user.
-
- [EROFS] The named file resides on a read-only file system.
-
- [EFAULT] _P_a_t_h points outside the process's allocated address space.
-
- [EIO] An I/O error occurred while reading from or writing to the
- file system.
-
-
-
- FFcchhoowwnn() will fail if:
-
- [EBADF] _F_d does not refer to a valid descriptor.
-
- [EINVAL] _F_d refers to a socket, not a file.
-
- [EPERM] The effective user ID is not the super-user.
-
- [EROFS] The named file resides on a read-only file system.
-
- [EIO] An I/O error occurred while reading from or writing to the
- file system.
-
- SSEEEE AALLSSOO
- chown(8), chgrp(1), chmod(2), flock(2)
-
- SSTTAANNDDAARRDDSS
- The cchhoowwnn() function is expected to conform to IEEE Std1003.1-1988
- (``POSIX'').
-
- HHIISSTTOORRYY
- The ffcchhoowwnn() function call appeared in 4.2BSD.
-
- The cchhoowwnn() and ffcchhoowwnn() functions were changed to follow symbolic links
- in 4.4BSD.
-
- 4th Berkeley Distribution April 19, 1994 2
-